<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			var arr = new Array();
			//增
			// arr[0] =  1;
			arr.push("zhangsan");
			arr.push('lisi');
			arr.push('wangwu');
			arr.push('zhaoliu');
			arr.push('wanger');
			arr.push('xiaoming');

			//遍历
			//高阶函数:把函数作为函数的参数
			arr.forEach(function(currentValue, index, array) { //回调函数
				// console.log(currentValue);
				// console.log(index);
				// console.log(array);
			})

			arr.forEach(function(currentValue) { //回调函数
				// console.log(currentValue);
			})

			//查
			// console.log(arr.indexOf('wangwu'));
			// console.log(arr.lastIndexOf('wangwu'));

			//改
			// arr.splice(0, 1, 'zhangsansan');
			//删
			// arr.splice(1, 2);
			// console.log(arr);

			//过滤
			var newArr = arr.filter(function(val) {
				return val == 'wangwu';
			});

			console.log(newArr);
		</script>
	</body>
</html>
